package xcmg.device.web.wechat;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import xcmg.device.dao.entity.area.HatAreaDO;
import xcmg.device.dao.entity.area.HatCityDO;
import xcmg.device.dao.entity.area.HatProvinceDO;
import xcmg.device.infra.BasicController;
import xcmg.device.service.wechat.AreaInfoService;
import yb.ecp.fast.infra.infra.ActionResult;

import java.util.List;

@RestController
@RequestMapping("/areaInfo")
public class AreaInfoController extends BasicController {
    @Autowired
    private AreaInfoService areaInfoService;

    @RequestMapping(value = "/allProvince",method = RequestMethod.GET)
    public ActionResult allProvince(){
        List<HatProvinceDO> result= areaInfoService.allProvince();
        return actionValueResult(result);
    }

    @RequestMapping(value = "/cityByProvince",method = RequestMethod.GET)
    public ActionResult cityByProvince(String father){
        List<HatCityDO> result= areaInfoService.cityByProvince(father);
        return actionValueResult(result);
    }

    @RequestMapping(value = "/areaByCity",method = RequestMethod.GET)
    public ActionResult areaByCity(String father){
        List<HatAreaDO> result= areaInfoService.areaByCity(father);
        return actionValueResult(result);
    }

    @RequestMapping(value = "/getPassword",method = RequestMethod.GET)
    public ActionResult getPassword(String userId,String pwd) throws Exception {

        return actionValueResult(areaInfoService.getPwd(userId,pwd));
    }
}
